<extend name="Layout/ins_page" />
<block name="content">
    <link href="/sap/demo.css" rel="stylesheet" type="text/css" />
    <script src="/sap/scripts/boot.js" type="text/javascript"></script>
    <div  id='fm1'>
       <fieldset id="fd1" style="border: 1px solid #e5e5e5;height: 50px">
        <legend><span></span></legend>
        <div id="fm1">
        <div class="fieldset-body" style="margin:0px 5px;">
                 
 <!--          买家姓名： <input id="U_Cstname"  name="U_Cstname" class="mini-textbox" enabled='false' />
          手机号码： <input  id="U_Phone"  name="U_Phone" class="mini-textbox"  value=""enabled='false' /><br/><br/> -->
         渠道编码： <input type="text" id="CardCode"  name="CardCode" class="mini-textbox" autocomplete="off" placeholder="" />
         <!--渠道名称：<input type="text" class="mini-textbox" autocomplete="off" placeholder="" id="ShortName" name="ShortName">-->        
          <a class="mini-button" onClick="search()" ><span class="mini-button-text ">&nbsp;&nbsp;查询&nbsp;&nbsp;</span></a> 
          
        </div>
        
        
        
          </div>
    </fieldset>
     
        <div class="fieldset-body">

            <div id="tabs1" class="mini-tabs" activeIndex="0" style="width:100%;margin-top: 5px;overflow:auto;" plain="false"
                 buttons="#tabsButtons"
            >
                <div title="列表：" >

                    <div id="datagrid1" class="mini-datagrid" style="height:430px;width: 100%;"
                         url="/Platform/getPlatformList" idField="Id"
                         allowResize="true"
                         allowCellEdit="true" allowCellSelect="true" multiSelect="true"
                         allowCellValid="true" oncellvalidation=""
                    >

                        <div property="columns">

                           
                             <div field="CardCode"  headerAlign="center"  >渠道编码
                                <input property="" class="mini-textbox" style="width:100%;" />
                            </div>
                            
                            <div field="ShortName"  headerAlign="center"  >渠道名称
                                <input property="" class="mini-textbox" style="width:100%;" />   
                            </div> 
                            <div field="ChannelType"  headerAlign="center"  >类型
                                <input property="" class="mini-textbox" style="width:100%;" />   
                            </div> 
                             <div field="CManager"  headerAlign="center"  >平台负责人
                                <input property="" class="mini-textbox" style="width:100%;" />   
                            </div>  
                            <div field="update"  headerAlign="center"  >操作
                                <input property="" class="mini-textbox" style="width:100%;" />   
                            </div>
                                                     
                            

                        </div>
                    </div>
                </div>
                <!-- <div title="Tab2" iconCls="" >
                    2
                </div> -->
            </div>
        </div>
    </div>


    </body>
    <script type="text/javascript">
        mini.parse();
        var grid = mini.get("datagrid1");
        grid.setPageSize(50);
        grid.load();
        grid.on("drawcell", function (e) {
            var record = e.record,
                column = e.column,
                field = e.field,
                value = e.value;

         
			 if (field == "update") {
                e.cellHtml = '<a href="javascript:updatePlatform(\''+record.CardCode+'\')"  >编辑</a>';
            }
			
			

        });
         function search(){
			 
			 
		
			var CardCode = mini.get('CardCode').getValue();
			//var ShortName = mini.get('ShortName').getValue();
			 grid.load({CardCode: CardCode})
	         //grid.load({CardCode: CardCode,ShortName:ShortName})      
      	  /*$.ajax({
         
			  url:"/Platform/getPlatformList",
              data: {phone: phone,orderSn:orderSn},
              type: "post",
              dataType:'json',
              success: function (data) {
            	  mini.unmask(document.body);
                  grid.setData(data.data);
                  grid.validateRow(newRow);   //加入新行，马上验证新行
                
              },
              error: function (jqXHR, textStatus, errorThrown) {
				
                  alert(jqXHR.responseText);
              }
          });*/

        }
		
		function exportData()
		{
			var product_name = mini.get('product_name').getValue();
			var product_id = mini.get('product_id').getValue();
	        var url="index.php?m=&c=Order&a=downloadboc365stock&product_id="+product_id+"&product_name="+product_name;
	        location.href=url;
		}
        function updatePlatform(CardCode){
            mini.open({
                url:  "/index.php?m=&c=Platform&a=editPlatform&CardCode="+CardCode,
                title: "编辑渠道",
                width: 800,
                height: 380,
                ondestroy: function (action) {
                    if (action == "ok") {

                    }

                }
            });

        }
         

        function approve(list_tag,approve) {

            //确认提示
            mini.confirm("确定？", "确定？",
                function (action) {
                    if (action == "ok") {

                        $.ajax({
                            url: "/SapSupplier/doupdatesapitemfromexcel",
                            type: "post",
                            data: {list_tag: list_tag, approve: approve},
                            dataType: 'json',
                            success: function (data) {
                                mini.alert(data.msg);
                            }
                        });


                    } else {

                    }
                }
            );

        }






    </script>
</block>

